package com.wcf.thread.demo;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by hadoop on 2016/1/31.
 */
public class TestThread {
//    单个线程的线程池
    private static final ExecutorService pool = Executors.newSingleThreadExecutor();
//    固定大小的线程池
//    private static final ExecutorService pool = Executors.newFixedThreadPool(5);
//    缓存的线程池
//    private static final ExecutorService pool = Executors.newCachedThreadPool();

    public static void main(String[] args) {
        Thread t1= new Thread(new Mythread("t1"));
        Thread t2= new Thread(new Mythread("t2"));
        Thread t3= new Thread(new Mythread("t3"));
        Thread t4= new Thread(new Mythread("t4"));
        Thread t5= new Thread(new Mythread("t5"));

        pool.execute(t1);
        pool.execute(t2);
        pool.execute(t3);
        pool.execute(t4);
        pool.execute(t5);
        pool.shutdown();
    }

}
